<div style="text-align: center;">
	<ul class="pagination">
	<li><span class="text-muted">总条数：{{totalElements}}，页数：{{totalPage}}</span></li>
	{{#hasPreviousPage}}
	<li><a href="?page=1" title="首页">&lt;&lt;</a></li>
    <li><a href="?page={{prevPage}}" title="上一页">&lt;</a></li>
    {{/hasPreviousPage}}
	{{^hasPreviousPage}}
    <li class="disabled"><a href="javascript:void(0);" title="首页">&lt;&lt;</a></li>
    <li class="disabled"><a href="javascript:void(0);" title="上一页">&lt;</a></li>
    {{/hasPreviousPage}}
 
 	{{#indexs}}
 	<li {{#currentIndex}}class="active"{{/currentIndex}}><a href="?page={{index}}">{{index}}</a></li>
    {{/indexs}}
	{{#hasNextPage}}
    <li><a href="?page={{nextPage}}" title="下一页">&gt;</a></li>
    <li><a href="?page={{totalPage}}" title="尾页">&gt;&gt;</a></li>
    {{/hasNextPage}}
    {{^hasNextPage}}
    <li class="disabled"><a href="javascript:void(0);" title="下一页">&gt;</a></li>
    <li class="disabled"><a href="javascript:void(0);" title="尾页">&gt;&gt;</a></li>
    {{/hasNextPage}}
    <li>
    	<span style="padding:5px 5px;width:45px;ime-mode:disabled">
    		<input id="txt_pg_number" type="text" placeholder="页号" imemode="disabled" 
    			style="width:100%;border:none;text-align:center"
    			onkeypress="return event.keyCode>=48&&event.keyCode<=57"
    			onpaste="return !clipboardData.getData('text').match(/\D/)"
				ondragenter="return false"/>
    	</span>
    </li>
    <li><a href="javascript:void(0);" onclick="handlePageJump()" title="页号跳转"><span class="glyphicon glyphicon-play"></span>&nbsp;</a></li>
	</ul>
</div>
<script type="text/javascript">
/**
 * 获取URL的所有查询参数
 */
function getUrlQueryParams(url){
	var params = {};
	var regex = /[\?&]([a-zA-Z_]+)=([\w\-\.]*)/g;
    while( ( results = regex.exec( url ) ) != null ){
    	params[results[1]]=results[2];
    }
    return params;
}
function mergeObjects(pa, pb){
	var pm={}, p;
	for(p in pa){
		pm[p]=pa[p];
	}
	for(p in pb){
		pm[p]=pb[p];
	}
	return pm;
}
function buildQueryString(params){
	var kvs=[];
	for(p in params){
		kvs.push(p+'='+params[p]);
	}
	return '?'+kvs.join('&');
}
function handlePageJump(){
	var txtPageNo=$('#txt_pg_number'), text=txtPageNo.val(), maxPageNo={{totalPage}};
	if(text.length==0 || maxPageNo<=0){
		return;
	}
	var num=parseInt(text);
	if(isNaN(num) || num<=0){
		num=1;
	}
	if(num>maxPageNo){
		num=maxPageNo
	}
	var params=getUrlQueryParams(window.location.href);
	params['page']=num;
	txtPageNo.val(num);
	window.location.href=buildQueryString(params);
}
$(function(){
	//把当前url中的查询参数添加到分页链接中
	var params=getUrlQueryParams(window.location.href);
	$('ul.pagination a').each(function(i, dom){
		var href=dom.href;
		if(href.indexOf('javascript:')==-1){
			var mergedParams=mergeObjects(params, getUrlQueryParams(href));
			dom.href=buildQueryString(mergedParams);
		}
	});
});
</script>